package cn.yc.reader;

import java.io.BufferedWriter;
import java.io.FileWriter;

public class FileWriter_ {
    public static void main(String[] args) throws Exception{
        String filePath = "e:\\io\\a.txt";
//        BufferedWriter bufferedWriter  = new BufferedWriter(new FileWriter(filePath));
        BufferedWriter bufferedWriter  = new BufferedWriter(new FileWriter(filePath,true));// 追加写入
        bufferedWriter.write("输入第一句话");
        // 插入一个和系统相关的换行
        bufferedWriter.newLine();
        bufferedWriter.write("输入第二句话");
        bufferedWriter.newLine();
        bufferedWriter.write("输入第三句话");
        bufferedWriter.newLine();
        // 关闭流
        // 注意：关闭外层流即可，底层会自动关闭节点流
        bufferedWriter.close();
    }
}
